package com.zlm.spider.util;

import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Harbour
 * @date 2021-04-12 15:57
 */
@Component
public class DateUtils {

    public static String getCurrentTime() {
        return new SimpleDateFormat("yyyy-MM-dd HH-mm-ss").format(new Date());
    }

    public static String getCurrentDate() {
        return new SimpleDateFormat("yyyy-MM-dd").format(new Date());
    }

    public static String getCurrentTime(String pattern) {
        return new SimpleDateFormat(pattern).format(new Date());
    }
}
